package controllers

import (
	"net/http"

	"github.com/gin-gonic/gin"
	gorm "gorm.io/gorm"
)

type DictDataController struct {
	db *gorm.DB
}

func NewDictDataController(db *gorm.DB) *DictDataController {
	return &DictDataController{db: db}
}

func (c *DictDataController) GetTreeData(ctx *gin.Context) {
	dictType := ctx.Query("dictType")

	if dictType == "sys_user_sex" {
		data := []gin.H{
			{
				"name":  "男",
				"pId":   "0",
				"id":    "1148141421644824576",
				"value": "1",
			},
			{
				"name":  "女",
				"pId":   "0",
				"id":    "1148141421699350528",
				"value": "2",
			},
		}
		ctx.JSON(http.StatusOK, data)
		return
	}

	ctx.JSON(http.StatusNotFound, gin.H{"message": "DictType not found"})
}
